﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Process.DAL;
using Process.Entities;

namespace Process.BLL
{
    public class SessionBLL
    {
        private SessionDAL _SessionDAL = new SessionDAL();

        public static string ValidateSession(string sID)
        {
            if (String.IsNullOrEmpty(sID)) { throw new Exception(); }

            SessionENT session = SessionDAL.GetSessionByID(sID);
            if (String.IsNullOrEmpty(session.SessionID)) { throw new Exception(); }

            return session.PartnerID;
        }

        public bool InsertSession(string sID, string partnerID)
        {
            SessionENT session = new SessionENT
            {
                SessionID = sID,
                PartnerID = partnerID
            };
            return _SessionDAL.InsertSession(session);
        }
    }
}
